<h1>Schedule Planner</h1>
<br/>      
<?php
$img_properties = array(
    'style' => 'float:right; margin-left:100px'
);
echo load_image('schedule/calendar.jpg', $img_properties);
?>

<div style="width: 700px">
    <p>Now that you have made a smart choice. But what do you have to prepare in order to live your dream in your ideal overseas university?</p>
    <p>It will be a good idea to plan all those preparative activities systematically in a schedule, and follow it accordingly. Let the great journey start from a schedule planner!</p>
</div>
<br/>
<!--Create form for deleting schedule-->
<h2>Your Schedule at a Glance:</h2>
<hr/>
<?php
echo form_open('schedule/delete_schedules');
?>
<!--Start of table-->
<table>
    <tr>
        <td></td>
        <td>Schedule Name</td>
        <td>Destination Country</td>
        <td>Remark</td>
        <td>Number of Activity</td>
        <td>Sync with Google Calendar</td>
        <td>Create Date</td>                
        <td>Edit</td>
    </tr>

    <?php
    if (count($schedule) != 0) {
        foreach ($schedule as $row) {
            ?>
            <tr>
                <td>
                    <input type="checkbox" <?php echo 'id = "checkbox_' . $row->schedule_id . '"'; ?> name="schedule_id[]" value="<?php echo $row->schedule_id ?>"
                           onclick="if(<?php echo $row->no_of_activity; ?> != 0){ document.getElementById('schedule_msg').innerHTML = 'Please ensure no activity is associated with the schedule before deleting it!';
                               document.getElementById(<?php echo "'checkbox_" . $row->schedule_id . "'"; ?>).checked = false;}"/>
                </td>
                <td><?php echo anchor('schedule/maintain_schedule/' . $row->schedule_id . '/' . $row->country_id, $row->schedule_name) ?></td>
                <td><?php echo $row->country_name; ?> </td>
                <td><?php echo $row->schedule_remark; ?></td>
                <td><?php echo $row->no_of_activity; ?></td>
                <td>
                    <?php
                    if ($row->sync_gcalendar == 1) {
                        $sync = "Yes";
                    } else {
                        $sync = "No";
                    }
                    echo $sync;
                    ?>
                </td>
                <td><?php echo $row->create_date; ?></td>    
                <td><?php echo anchor('schedule/update_schedule/' . $row->schedule_id, 'Edit') ?></td>
            </tr>
            <?php
        }
    }
    ?>
</table>
<!--End of table-->

<?php
echo form_submit(array('name' => 'submit', 'id' => 'delete_schedule'), 'Select Schedule to Delete');
echo nbs(3);
echo '<span id="schedule_msg"></span>';
echo form_close();
?>
<!--End of form-->
<!--Link to create schedule  -->
<?php echo anchor('schedule/create_schedule', 'Create a new Schedule') ?>

